import java.util.Stack;

public class Test {
    class MyQueue {
        Stack<Integer> s1;
        Stack<Integer> s2;
        public MyQueue() {
            s1=new  Stack<>();
            s2=new  Stack<>();
        }

        public void push(int x) {
            s1.push(x);

        }

        public int pop() {
            if(empty()){
                return -1;
            }
            if(s2.isEmpty()){
                s2.push(s1.pop());
            }
            return s2.pop();
        }

        public int peek() {
            if(empty()){
                return -1;
            }
            if(s2.isEmpty()){
                s2.push(s1.pop());
            }
            return s2.peek();
        }
    }


}
    public static void main(String[] args) {

    }
}
